package com.ceba.test.modules.admin.service;
import java.util.List;
import java.util.Map;

import abc.data.DataTable;
import com.ceba.base.web.service.IBaseService;
import com.ceba.test.base.configs.CebaPathUtil;
import com.ceba.test.modules.admin.dao.GReportMergeDao;
import com.ceba.test.modules.admin.entity.GReportMerge;
import com.ceba.test.modules.admin.entity.ViewFondreReportMerge;


public class GReportMergeService extends IBaseService {
	
	private GReportMergeDao gReportMergeDao;

	/**
	 * 根据id获取
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public GReportMerge getReportMergeById(String id) throws Exception{
		
		return gReportMergeDao.getReportMergeById(id);
	}

	/*
	 * 根据id删除
	 */
	public boolean deleteReportMergeById(String id) {
		
		return gReportMergeDao.deleteReportMergeById(id);
	}

	public boolean updateReportMerge(GReportMerge rm) {
	   return gReportMergeDao.updateReportMerge(rm);
	}

	
	public boolean insertReportMerge(GReportMerge rm) {
		return gReportMergeDao.insertReportMerge(rm);
	}

	/**
	 * 根据名称查找
	 * @param name
	 * @return
	 */
	public boolean checkReportMergeByName(String name,String id) {
	return gReportMergeDao.checkReportMergeByName(name,id);
	}

	public String getReportMergeList(String key, Map<String,Object> dic){
		 return gReportMergeDao.getReportMergeList(key,dic);
	}

	public long getReportMergeCount(String key, Map<String,Object> dic){
		 return gReportMergeDao.getReportMergeCount(key,dic);
	}

	public List<GReportMerge> getReportMergeListOne(String key){
		 return gReportMergeDao.getReportMergeListOne(key);
	}
	public List<GReportMerge> getCoverEndListSqlUserId(String userId) throws Exception{
			return gReportMergeDao.getCoverEndListSqlUserId(userId);
	}

	/**
	 * 获取用户封面尾页授权列表
	 */
	public  String getUserQifengStampPicList(String userId) throws Exception{
		DataTable dtName = gReportMergeDao.getUserCoverEndStampPicList(userId);
		String coverName = "";
		if(dtName !=null && dtName.getRowCount() >0){
			for (int j = 0; j < dtName.getRowCount(); j++) {
				//获取去图片路径
				coverName += dtName.getRow(j).getString("NAME")+",";
			}
		}
		if(dtName.getRowCount() > 0){
            coverName = coverName.substring(0,coverName.length()-1);
        }
		return coverName;
	}
	
	public String getFilePathByMergeId(String id,String fieldName){
		return gReportMergeDao.getFilePathByMergeId(id, fieldName);
	}
	
	public ViewFondreReportMerge getViewFondreReportMerge(String reportMergeId){
		return gReportMergeDao.ViewFondreReportMerge(reportMergeId);
	} 

	

	
	
	
	public GReportMergeDao getgReportMergeDao() {
		return gReportMergeDao;
	}

	public void setgReportMergeDao(GReportMergeDao gReportMergeDao) {
		this.gReportMergeDao = gReportMergeDao;
	}

}
